Fix stutter on returning to song select when updating large beatmap sets - #38514
Fix stutter on returning to song select when updating large beatmap sets#38514SevenSec114 wants to merge 6 commits into
Conversation
|
|
My bad for the test failure. I ran the tests I thought were affected and they passed, so I relied on the github CI for the rest. Also this change is the actual performance fix: -Items.ReplaceRange(previousIndex, 1, [matchingNewBeatmap]);
+Items.ReplaceRange(previousIndex, oldSetBeatmaps.Count, newBeatmaps);but I forgot to flip the rest logic in Code is written by myself, I spent a lot to figure out the logic. But before committing I found something like comments in my own language may be hard to understand so I polished a lot. |
|
Unsure why this PR is in draft, will probably not attempt review until it's out of draft. |
|
I'm now still working on it to find if there is any other issues appeared due to the logic changing, because I don't want it happened one more time. Please give me more time🙏 |
| { | ||
| // The matching beatmap may have been deleted or invalidated in some way since this event was fired. | ||
| // Let's make sure we have the most up-to-date realm state of the current beatmap. | ||
| var refreshedNewBeatmap = realm.Run(r => r.FindWithRefresh<BeatmapInfo>(matchingNewBeatmap.ID)?.Detach()); |
|
I found myself over-engineered. But I'm not sure if this test should be removed later since the crash is caused by the assertion in beatmap = realm.Run(r => r.Find<BeatmapInfo>(workingBeatmap.Value.BeatmapInfo.ID)!.ToLive(realm)); |
Addresses the stutter reported in #35129, whose regression introducer was bisected to the per-difficulty realm check added in #34914.
When a beatmap set is updated (e.g. returning from gameplay with a large set, or exiting the editor), the carousel's replace handling previously:
realm.Run(...FindWithRefresh...Detach())round trip on the update thread for every difficulty of the set (added in Fix errors on exiting from editor if there are no more beatmaps remaining for the ruleset active in song select #34914 to fix Editor: error popup when changing game mode of beatmap #34826, first surfaced as the regression in Game freezes when returning to song select from results screen #35129)This is unnecessary for the items that are not the current selected beatmap since the crash is only by the
RequestSelectiongiven the invalid beatmap.